package it.mf.eclipseutils;

import java.net.URL;

import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;

public class PluginTool {
	public static Bundle getPlugin(String id)
	{
		return Platform.getBundle(id);
	}
	
	public static String findFileInBundle(String bundleId, String researchPath)
	{
		Bundle bundle;
		URL entry;
		
		bundle=getPlugin(bundleId);
		if(bundle!=null)
		{
			entry=bundle.getEntry(researchPath);
			
			if(entry!=null)
				return entry.toString();
			else return null;
		}
		else return null;
	}
}
